home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue57 / System / AnimateDemoForm.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-03-28  |  1.9 KB  |  71 lines

  1. unit AnimateDemoForm;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   ExtCtrls, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Memo1: TMemo;
  12.     CheckBox1: TCheckBox;
  13.     Panel1: TPanel;
  14.     Edit1: TEdit;
  15.     procedure FormShow(Sender: TObject);
  16.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  17.   private
  18.     { Private declarations }
  19.   public
  20.     { Public declarations }
  21.   end;
  22.  
  23. var
  24.   Form1: TForm1;
  25.  
  26. implementation
  27.  
  28. {$R *.DFM}
  29.  
  30. const
  31.     // LWA constants for SetLayeredWindowAttributes
  32.     lwa_ColorKey        = 1;
  33.     lwa_Alpha           = 2;
  34.  
  35.     // New extended window style for layering
  36.     ws_Ex_Layered       = $80000;
  37.  
  38.     // AnimateWindow flags
  39.     aw_Hor_Positive     = $00000001;
  40.     aw_Hor_Negative     = $00000002;
  41.     aw_Ver_Positive     = $00000004;
  42.     aw_Ver_Negative     = $00000008;
  43.     aw_Center           = $00000010;
  44.     aw_Hide             = $00010000;
  45.     aw_Activate         = $00020000;
  46.     aw_Slide            = $00040000;
  47.     aw_Blend            = $00080000;
  48.  
  49. function SetLayeredWindowAttributes (Wnd: hWnd; crKey: ColorRef; bAlpha: Byte; dwFlags: DWord): Bool; stdcall;
  50. external 'user32.dll';
  51.  
  52. function UpdateLayeredWindow (Wnd: hWnd; hdcDst: HDC; var pptDst: TPoint;
  53.                               var psize: TSize; hdcSrc: HDC; var pptSrc: TPoint;
  54.                               crKey: ColorRef; var pblend: BlendFunction; dwFlags: DWord): Bool; stdcall;
  55.                               external 'user32.dll';
  56.  
  57. function AnimateWindow (Wnd: hWnd; dwTime, dwFlags: DWord): Bool; stdcall;
  58. external 'user32.dll';
  59.  
  60. procedure TForm1.FormShow(Sender: TObject);
  61. begin
  62.     AnimateWindow (Handle, 200, aw_Hor_Positive);
  63. end;
  64.  
  65. procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
  66. begin
  67.     AnimateWindow (Handle, 400, aw_Hor_Negative or aw_Hide);
  68. end;
  69.  
  70. end.
  71.